Python Network Programming Techniques by Marcel Neidinger
How to do itâ¦
The following steps demonstrate how to connect to a device and retrieve some facts about it using the getters that NAPALM provides:
Import the napalm module:import napalm
From the napalm module, retrieve the approprtiate driver for your device's vendor. Please refer to the How it works⦠section of the Connecting to devices from different vendors using NAPALM recipe for a list of possible drivers:driver = napalm.get_network_driver("<insert driver name>")
Specify the connection details of your device. Note that you can pass a non-standard port in the optional arguments. If your device connects on the standard port, you can omit this:conn_details = {
"hostname": "<insert hostname>",
"username": "<insert username>",
"password": "<insert password>",
"optional_args": {
"port": <insert port as integer>
}
}